define(['app'], function(app) {
	'use strict';

	var controller = function controller($scope, Hotcat) {
		$scope.input = new Object();
		$scope.input.key = '';
		$scope.store_cat = '';
		$scope.input.store_cat1 = '';
		$scope.input.store_cat2 = '';
		$scope.input.store_cat3 = '';
		$scope.selectTab = 0;
		$scope.activeTab = function(index) {
			$scope.selectTab = index;
		}
		$scope.init_data = function(){
			Hotcat.hotcat_list($scope.input.key,$scope.input.store_cat,function(data){
				$scope.datas = data;
			})
		}
		$scope.doSearch = function(){
			if($scope.input.store_cat1!=''||$scope.input.store_cat2!=''||$scope.input.store_cat3!=''){
				$scope.store_cat = $scope.input.store_cat1+','+$scope.input.store_cat2+','+$scope.input.store_cat3;
				Hotcat.hotcat_list($scope.input.key,$scope.input.store_cat,function(data){
				$scope.datas = data;
			})
			}
			
			
		}
		$scope.init_data();
	}

	controller.$inject = ['$scope', 'Hotcat'];
	
	return app.registerController("hotcatctrl",controller);
});